import React, { useCallback } from 'react';
import _ from 'lodash';
const useInputChange = (fn: any, delay = 500, ...arg: any) => {
  let innerFn = useCallback(_.debounce(fn, delay), []);
  let newFn = (e: any) => {
    e.persist();
    innerFn(e.target.value, e);
  };
  return newFn;
};

export default useInputChange;
